package com.example.demo.entryWarehouse.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.common.ResponseData;
import com.example.demo.entryWarehouse.entity.EntryForm;
import com.example.demo.entryWarehouse.mapper.EntryFormMapper;
import com.example.demo.entryWarehouse.service.EntryFormService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wangxuan
 * @since 2021-05-03
 */
@Service
public class EntryFormServiceImpl extends ServiceImpl<EntryFormMapper, EntryForm> implements EntryFormService {

    @Autowired
    private EntryFormMapper entryFormMapper;

    @Override
    public ResponseData selectAll() {
        List<EntryForm> entryFormList =new ArrayList<>();
        entryFormList = entryFormMapper.selectList(null);
        return ResponseData.buildOk(entryFormList);
    }

    @Override
    public ResponseData selectBetweenDate(String begindate, String enddate) {
        List<EntryForm> entryFormList =new ArrayList<>();
        QueryWrapper<EntryForm> wrapper = new QueryWrapper<>();
        wrapper.between("entry_date",begindate,enddate);
        entryFormList = entryFormMapper.selectList(wrapper);
        return ResponseData.buildOk(entryFormList);
    }
}
